gtkrange: group gestures the right way around
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 9 Jul 2020 18:44:42 +0000 (20:44 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 9 Jul 2020 18:49:25 +0000 (20:49 +0200)
The gtk_gesture_group() call is not a commutative operation, it
takes two gestures, maybe detaches the first one from its current
group, and adds it to the same group than the second gesture.

With the flipped argument order here, GtkRange was actually detaching
the same gesture in order to group it with a second one two times, so
the desired effect to group all 3 gestures was not achieved.

Fixes autoscroll as the drag gesture is now actually grouped with the
click one, so drag offsets can be accessed from the autoscroll
timeout.

gtk/gtkrange.c

index 91f16b5133ec1eb4b90c2cafc35d2f01b5f0a485..e76ca4e68895c6568b58d73c2db518e016a7b95d 100644 (file)
@@ -567,14 +567,14 @@ gtk_range_init (GtkRange *range)
   g_signal_connect (gesture, "released",
                     G_CALLBACK (gtk_range_click_gesture_released), range);
   gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
-  gtk_gesture_group (priv->drag_gesture, gesture);
+  gtk_gesture_group (gesture, priv->drag_gesture);
 
   gesture = gtk_gesture_long_press_new ();
   gtk_gesture_long_press_set_delay_factor (GTK_GESTURE_LONG_PRESS (gesture), 2.0);
   g_signal_connect (gesture, "pressed",
                     G_CALLBACK (gtk_range_long_press_gesture_pressed), range);
   gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
-  gtk_gesture_group (priv->drag_gesture, gesture);
+  gtk_gesture_group (gesture, priv->drag_gesture);
 
   controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
   g_signal_connect (controller, "scroll",